<template>
  <view class="page-warp">
    <pk-authuser @onLogin="onLogin"></pk-authuser>
  </view>
</template>

<script setup>
  import { ref, onMounted, defineEmits } from 'vue';
  import { onLoad } from '@dcloudio/uni-app'
  import { urlToObj } from '@/utils/utils'
  const show = ref(false)
  const data = ref({})
  const tempdata = ref({})
  onLoad((e) => {
    data.value = e 
  })

  const goToNav = (e) => {
    // 扫码进来的
    if (data.value.q) {
      const PARAMURL = decodeURIComponent(data.value.q)
      const { key, page} = urlToObj(PARAMURL)
      if (page == '/pages/invitation/index') {
        uni.redirectTo({
          url: '/pages/invitation/index?key='+ key
        });
      }
    } else if (data.value.cb)  {
      const path = decodeURIComponent(data.value.cb)
      uni.redirectTo({
        url:path 
      });
    }
  }

  const onLogin = (e) => {
    goToNav()
  }
</script>

<style lang="scss" scoped>
  .page-warp{
    font-size: 24rpx;
  }
</style>